import axios from "axios"
import {get} from '@/utils/storage'
const instance = axios.create({
    baseURL: '/dev-api'
})


// 设立请求拦截器在请求头里追加token  给个请求头验证给回应
instance.interceptors.request.use(function (config) {
    // Do something before request is sent
    // 回调函数会传到设置里
    const token = get('user_token')
    console.log(`token: ${token}`);
config.headers.Authorization = `Bearer ${token} `
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

export default instance